#!/usr/bin/env python3
# -*- coding: utf-8 -*
# src/plot_data/comparecase.py
import sys 
import os

sys.path.append("..")
from package.utility import ensure_exists
from package.utility import find_targets

def get_runcases(topdir,jsonname="*-database.json"):
    """Get runcase under topdir."""
    topdir = os.path.abspath(topdir)
    ensure_exists(topdir)

    print(f">> scan runcase under {topdir}") 
    runcases = find_targets(topdir, jsonname, suffix="-xtype f") 
    runcase_num = len(runcases)
    print(f">> {runcase_num} runcases found!")

    return runcases